/**
 * creator:WhiteBird
 * create time:2016/10/20
 * email:zhiqiang.zhao@dhc.com.cn
 **/

var exec = require('cordova/exec');

var whiteBird = function () {
};
/*
 * 别名类型标识
 * 在应用关于Alias别名方法时可应用如下:window.whiteBirdUPMethod.addAlias('334916490',window.whiteBirdUPMethod.AliasType['QQ'],......
 */
whiteBird.AliasType = {
  //新浪微博
  SINA: 0,
  //腾讯微博
  TENCENT: 1,
  //QQ
  QQ: 2,
  //微信
  WEIXIN: 3,
  //百度
  BAIDU: 4,
  //人人网
  RENREN: 5,
  //开心网
  KAIXIN: 6,
  //豆瓣
  DOUBAN: 7,
  //facebook
  FACEBOOK: 8,
  //twitter
  TWITTER: 9
};
/*
 * 对推送设备添加推送标签
 */
whiteBird.addTag = function (tags, successCallback, errorCallback) {
  exec(successCallback, errorCallback, "WhiteBirdPluginUP", "addTag", [tags]);
};
/*
 * 移除推送设备的推送标签
 */
whiteBird.removeTag = function (tags, successCallback, errorCallback) {
  exec(successCallback, errorCallback, "WhiteBirdPluginUP", "removeTag", [tags]);
};
/*
 * 获取推送设备的标签列表
 */
whiteBird.getTags = function (successCallback, errorCallback) {
  exec(successCallback, errorCallback, "WhiteBirdPluginUP", "getTags", []);
};
/*
 * 移除设备所有的推送标签
 */
whiteBird.removeAllTags = function (successCallback, errorCallback) {
  exec(successCallback, errorCallback, "WhiteBirdPluginUP", "removeAllTags", []);
};
/*
 * 对推送设备添加别名
 */
whiteBird.addAlias = function (alias,type,successCallback, errorCallback) {
  exec(successCallback, errorCallback, "WhiteBirdPluginUP", "addAlias", [alias,type]);
};
/*
 * 设置推送设备的别名,如果已经设置了别名,此方法会覆盖老的
 */
whiteBird.setAlias = function (alias,type,successCallback, errorCallback) {
  exec(successCallback, errorCallback, "WhiteBirdPluginUP", "setAlias", [alias,type]);
};
/*
 * 移除设备的推送别名
 */
whiteBird.removeAlias = function (alias,type,successCallback, errorCallback) {
  exec(successCallback, errorCallback, "WhiteBirdPluginUP", "removeAlias", [alias,type]);
};
/*
 * 对推送设备绑定渠道,默认为 App store
 */
whiteBird.setChannel = function (channel) {
  exec(null, null, "WhiteBirdPluginUP", "setChannel", [channel]);
};
/*
 * 获取推送成功之后的掉用js方法,因为cordova回调方法具有一对一的性质,使用时建议采用递归方式
 */
whiteBird.getPushBack = function (successCallback) {
  exec(successCallback, null, "WhiteBirdPluginUP", "getPushBack",[]);
};

module.exports = whiteBird;
